package com.kly.pay.eventbus;

import com.google.common.eventbus.AsyncEventBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;

import javax.annotation.Resource;

/**
 * EventBus 配置
 * @author linqu
 */
@Configuration
public class EventBusConfig {

    /**
     * 线程池的配置
     */
    @Resource
    private TaskExecutor taskExecutor;

    @Bean
    public AsyncEventBus asyncEventBus(){
        AsyncEventBus eventBus = new AsyncEventBus(taskExecutor);
        return eventBus;
    }
}
